package scalab.filters.selectors

trait EndsWith extends scalab.core.component.Selector
import scalab.utils.Path

/**
* Selects all the files whose canonical path ends with a given suffix.
*/

object EndsWith{
	import scalab.core.dependencies.Dependency
	def apply(componentName: String, suffix: String, staticDeps: Iterable[Dependency]): EndsWith = new EndsWith{
		override def select(d: Dependency): Boolean = d.canonicalPath.endsWith(Path(suffix))
		override val name: String = componentName
		override val staticDependencies = staticDeps
	}

	def apply(suffix: String, staticDeps: Iterable[Dependency]): EndsWith = apply("EndsWith", suffix, staticDeps)
	def apply(componentName: String, suffix: String): EndsWith = apply(componentName, suffix, Nil)
	def apply(suffix: String): EndsWith = apply(suffix, Nil)
}
